const baseUrl = "http://123.56.105.243:8080";
// let getst = wx.getStorageSync('gettoken')
let token = wx.getStorageSync('token') || ""
export const request = (params) => {
  wx.showLoading({
    title: '加载中....',
  })
  return new Promise((resolve, reject) => {
    wx.request({
      url: baseUrl + params.url,
      data: params.data || {},
      method: params.method || "get",
      header: {
        'content-type': 'application/json', // 默认值
        token: token
      },
      success: res => {
        resolve(res)
      },
      fail: err => {
        reject(err)
      },
      complete: res => {
        console.log("完成时", res);
        wx.hideLoading()
      }
    })
  })
}